home *** CD-ROM | disk | FTP | other *** search
- unit SimpleAccountFrm;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- AccountExample, StdCtrls;
-
- type
- TFrmAccountTest = class(TForm)
- ListBox1: TListBox;
- edtBalance: TEdit;
- lblBalance: TLabel;
- procedure FormCreate(Sender: TObject);
- private
- FAccount: TSimpleAccount;
- procedure AddNewLine(const Text: string; Amount: Currency);
- public
- { Pblic declarations }
- end;
-
- var
- FrmAccountTest: TFrmAccountTest;
-
- implementation
-
- {$R *.DFM}
-
- procedure TFrmAccountTest.AddNewLine(const Text: string; Amount: Currency);
- var
- Line: TAccountLine;
- begin
- Line := FAccount.AddLine(Text,Amount);
- ListBox1.Items.AddObject(Line.Text,Line);
- end;
-
- procedure TFrmAccountTest.FormCreate(Sender: TObject);
- begin
- FAccount := TSimpleAccount.Create;
- {
- Let's add some Account Lines
- }
- AddNewLine('Test Entry',150);
- AddNewLine('Another Entry',-100);
- AddNewLine('Entry # 3',300);
- {
- now lets calculate the balance
- }
- edtBalance.Text := FloatToStr(FAccount.Balance);
- {
- Ok, lets add another Account Line
- }
- AddNewLine('Big badaboom',50);
- edtBalance.Text := FloatToStr(FAccount.Balance);
- end;
-
- end.
-